import Vue from "vue";
import VueRouter from "vue-router";
import Main from '../views/Main.vue'
import Article from '../views/Article.vue'
import Write from '../views/Write.vue'
import Study from '../views/Study.vue'
import Message from '../views/Message.vue'
import History from '../views/History.vue'
import User from '../views/User.vue'
import ArticleDetail from '../views/ArticleDetail.vue'

Vue.use(VueRouter)

const routes = [
    {
        path:'/',
        component:Main,
        redirect:'home',
        children:[
            {
                name:'home',
                path:'home',
                component:Article
            },
            {
                name:'study',
                path:'study',
                component:Study
            },
            {
                name:'message',
                path:'message',
                component:Message
            },
            {
                name:'history',
                path:'history',
                component:History
            },
            {
                name:'user',
                path:'user',
                component:User
            },
            {
                name:'article',
                path:'article/:id',
                component:ArticleDetail
            }
        ]
    },
    {
        name:'write',
        path:'/write',
        component:Write
    }
]

const router = new VueRouter({
    routes
})
export default router